package com.night.icm.persistence.base.repository;

import com.night.icm.persistence.base.entity.Academy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * AcademyRepository
 *
 * @author Liao ZhiYong
 * @date 2020/1/5
 */
@Repository
public interface AcademyRepository extends JpaRepository<Academy, Long>, JpaSpecificationExecutor<Academy> {

    /**
     * 通过参数名查询学院信息
     *
     * @param code 参数名
     * @return 参数ID
     */
    @Query("select c.id from Academy as c where c.code = :code")
    Long findAcademyByCode(@Param("code") String code);
}
